package org.u2ml.app.domain;

import java.util.Collection;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;

@Entity
@XStreamAlias("oid")
public class Oid extends ResponseData {
	@XStreamAsAttribute
	transient private Long oid;
	
	@XStreamAsAttribute
	private Long value;
	
	transient private Collection<ProjectClass> children;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public Long getOid() {
		return oid;
	}
	
	public void setOid(Long oid) {
		this.oid = oid;
	}
	
	public Long getValue() {
		return value;
	}

	public void setValue(Long value) {
		this.value = value;
	}
	
	@ManyToMany(
			cascade={CascadeType.PERSIST, CascadeType.MERGE},
			mappedBy="parents"
	)
	public Collection<ProjectClass> getChildren() {
		return children;
	}

	public void setChildren(Collection<ProjectClass> children) {
		this.children = children;
	}
	
}
